﻿//-----------------------------------------------------------------------------
// <copyright file="ViewCreatedEventArgs.cs" company="William E. Kempf">
//     Copyright (c) William E. Kempf.
// </copyright>
//-----------------------------------------------------------------------------

namespace Onyx.Windows
{
    using System;
    using System.Windows;
    using Onyx.ComponentModel;

    /// <summary>
    /// Provides event data for the <see cref="E:View.Created"/> event.
    /// </summary>
    public class ViewCreatedEventArgs : EventArgs
    {
        /// <summary>
        /// The view element associated with the <see cref="View"/> that was created.
        /// </summary>
        private readonly DependencyObject viewElement;

        /// <summary>
        /// The <see cref="ServiceContainer"/> associated with the view that was created.
        /// </summary>
        private readonly IServiceRegistry serviceContainer;

        /// <summary>
        /// Initializes a new instance of the <see cref="ViewCreatedEventArgs"/> class.
        /// </summary>
        /// <param name="viewElement">The view element associated with the <see cref="View"/> that
        /// was created.</param>
        /// <param name="serviceContainer">The <see cref="ServiceContainer"/> associated with the
        /// <see cref="View"/> that was created.</param>
        internal ViewCreatedEventArgs(DependencyObject viewElement, IServiceRegistry serviceContainer)
        {
            this.viewElement = viewElement;
            this.serviceContainer = serviceContainer;
        }

        /// <summary>
        /// Gets the view element associated with the <see cref="View"/> that was created.
        /// </summary>
        /// <value>The view element associated with the <see cref="View"/> that was created.</value>
        public DependencyObject ViewElement
        {
            get { return this.viewElement; }
        }

        /// <summary>
        /// Gets the <see cref="ServiceContainer"/> associated with the <see cref="View"/> that was created.
        /// </summary>
        /// <value>The <see cref="ServiceContainer"/> associated with the <see cref="View"/> that was created.</value>
        public IServiceRegistry ServiceContainer
        {
            get { return this.serviceContainer; }
        }
    }
}
